import { LazyExoticComponent, ReactElement } from "react";
import { LoaderFunction } from "react-router-dom";
 
export type UserRole = "admin" | "editor" | "viewer";
 
export interface User {
  id: string;
  name: string;
  role: UserRole;
}
 
// 单独定义路由元素类型（支持普通元素和懒加载组件）
export type RouteElement = ReactElement | LazyExoticComponent<() => ReactElement>;
 
export interface RouteConfig {
  path: string;
  element: RouteElement;
  requiresAuth: boolean;
  roles?: UserRole[];
  loader?: LoaderFunction;
  children?: RouteConfig[];
}